apt update && apt install -y libarchive-tools && apt install -y curl

# 下载或更新
cloneOrPull() {
    GIT_URL=$1
    TARGET_DIR=$2
    if [ "$TARGET_DIR" == "" ]; then
        var1=${GIT_URL##*/}
        TARGET_DIR=${var1%.*}
    fi
    echo "GIT_URL=$GIT_URL"
    echo "TARGET_DIR=$TARGET_DIR"
    if [ ! -d "$TARGET_DIR/.git" ] || [ "$(git -C $TARGET_DIR status -s)" != "" ]; then
        rm -rf $TARGET_DIR
        mkdir -p $TARGET_DIR
        git clone $GIT_URL $TARGET_DIR
    else
        git -C $TARGET_DIR pull
    fi
}

#!/bin/bash
#拷贝依赖：

cloneOrPull https://gitee.com/LeemRp/flutter_embed_into_qt_depend.git
cloneOrPull https://gitee.com/LeemRp/fluttertpc_demo.git

if [ ! -f "commandline-tools-linux-x64-5.0.5.310.zip" ]; then
  # 文件不存在，执行下载命令
  curl -O https://repo.huaweicloud.com/harmonyos/ohpm/5.0.5/commandline-tools-linux-x64-5.0.5.310.zip
  bsdtar -xvf  /commandline-tools-linux-x64-5.0.5.310.zip
else
  echo "文件已经存在，跳过下载。"
fi

rm -rf /fluttertpc_window_manager_plus/ohos/har

mkdir /fluttertpc_window_manager_plus/ohos/har

cp /flutter_embed_into_qt_depend/flutter.har /fluttertpc_window_manager_plus/ohos/har



